package com.base.service;

import java.math.BigDecimal;
import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.base.po.voip.SelfShopOrder;
import com.base.po.voip.SelfShopOrderExample;
import com.base.utils.Page;

public interface SelfShopOrderService {
	int countByExample(SelfShopOrderExample example);

    int deleteByExample(SelfShopOrderExample example);

    int insert(SelfShopOrder record);

    int insertSelective(SelfShopOrder record);

    List<SelfShopOrder> selectByExample(SelfShopOrderExample example);
    
    SelfShopOrder selectByPrimaryKey(String id);

    SelfShopOrder selectByOrderID(String orderid);

    List<SelfShopOrder> selectByID(String id);
    
    List<SelfShopOrder> selectByMobile(@Param("mobile") String mobile, @Param("parentid") String parentid,
                                       @Param("shopid") String shopid);
    
    List<SelfShopOrder> selectAllOrder(@Param("page") Page page, @Param("mobile") String mobile,
                                       @Param("parentid") String parentid, @Param("shopid") String shopid);
    
    List<SelfShopOrder> selectByAll(@Param("page") Page page, @Param("parentid") String parentid,
                                    @Param("shopid") String shopid, @Param("mobile") String mobile,
                                    @Param("ordernum") String ordernum, @Param("goodstext") String goodstext,
                                    @Param("status") Byte status, @Param("deliverystatus") Byte deliverystatus,
                                    @Param("supplier") String supplier, @Param("createtime") String createtime,@Param("role") int user);

    List<SelfShopOrder> selectTransaction(@Param("page") Page page, @Param("parentid") String parentid,
                                          @Param("shopid") String shopid);

    List<SelfShopOrder> selectByIsTakeOver(@Param("parentid") String parentid, @Param("istakeover") Integer istakeover);

    int updateByExampleSelective(@Param("record") SelfShopOrder record, @Param("example") SelfShopOrderExample example);

    int updateByExample(@Param("record") SelfShopOrder record, @Param("example") SelfShopOrderExample example);
    
    int updateByPrimaryKeySelective(SelfShopOrder record);
    
    int countAllOrder(@Param("mobile") String mobile, @Param("parentid") String parentid,
                      @Param("shopid") String shopid);
    
    int countByAll(@Param("parentid") String parentid, @Param("shopid") String shopid,
                   @Param("mobile") String mobile, @Param("ordernum") String ordernum,
                   @Param("goodstext") String goodstext, @Param("status") Byte status,
                   @Param("deliverystatus") Byte deliverystatus,
                   @Param("supplier") String supplier, @Param("createtime") String createtime,@Param("role") int role);

    int countTransaction(@Param("parentid") String parentid, @Param("shopid") String shopid);
    
    //累计收益
    BigDecimal sumAllCash(@Param("parentid") String parentid, @Param("shopid") String shopid);
    
    //可提现收益
    BigDecimal sumCanCash(@Param("parentid") String parentid, @Param("shopid") String shopid,
                          @Param("cleartime") String cleartime, @Param("nowtime") String nowtime);

    List<SelfShopOrder>  selectBySelfShopID(String id,String fMobile,String fOrderNum,String fSupplier,Byte status,String fCreatetime,Page page);

    List<SelfShopOrder>  selectBySelfShopIDALL(String id,String fMobile,String fOrderNum,String fSupplier,Byte status,String fCreatetime);

    Integer countByShopId(String id,String fMobile,String fOrderNum,String fSupplier,Byte status,String fCreatetime);

    List<SelfShopOrder> selectAllbyDatetime(String selfShopId, String dateime1, String datetime2);

    List<SelfShopOrder> selectByAllNoPage(@Param("parentid") String parentid,
                                          @Param("shopid") String shopid, @Param("mobile") String mobile,
                                          @Param("ordernum") String ordernum, @Param("goodstext") String goodstext,
                                          @Param("status") Byte status, @Param("deliverystatus") Byte deliverystatus,
                                          @Param("supplier") String supplier, @Param("createtime") String createtime,@Param("role") int user);
}